# 学生类
# 老师类
#
# 学生有name,age 还有一个属性 是老师

class Teacher:

    def __init__(self, name):
        self.name = name

    def teach(self):
        print('{}正在教课'.format(self.name))


# kkx = Teacher(name="卡卡西")
# kkx.teach()


class Qingwa:

    def __init__(self, name):
        self.name = name

    def teach(self):
        print('呱呱呱', '捉虫子')


class Student:

    def __init__(self, name, age, teacher):
        self.name = name
        self.age = age
        self.teacher = teacher

    def student(self):
        print(self.name, '正在学习')


# mingren = Student(name="鸣人", age=7, teacher=kkx)
# print(mingren)
# print(mingren.name)
# print(mingren.teacher)
# # 学生的老师的姓名是啥
# print(mingren.teacher.name)

# 多态  我们本来需要一个父类的对象   我们提供了一个 子类的对象
# 父类的引用指向子类的实例

# 鸭子模式  我们需要一个对象     我们给了一个像这个对象的 对象

# hamaji = Qingwa(name="蛤蟆吉")
# naleduo = Student(name="鸣人", age=7, teacher=hamaji)
#
# print(naleduo.teacher.name)
